<?php
/**
 * This file is part of Hyperf Mall.
 *
 * @link     https://gitee.com/scwlkj/hyperf_mall
 * @contact  hyperf_mall@163.com
 */

declare(strict_types=1);
/**
 * Notes: 订单相关常量
 */

namespace App\Constants;

class OrderConstant
{
    //订单类型
    const ORDER_TYPE_NORMAL = 0;       //正常订单
    const ORDER_TYPE_SELL = 1;       //带货下单
    //支付表中支付状态
    const ORDER_PAY_STATUS_WAIT = 0;       //待支付
    const ORDER_PAY_STATUS_PAYING = 1;     //支付中
    const ORDER_PAY_STATUS_SUCCESS = 2;    //支付成功
    const ORDER_PAY_STATUS_CANCEL = 3;     //取消支付

    //取消支付方式
    const CANCEL_PAY_TYPE_USER = 1;      //用户取消
    const CANCEL_PAY_TYPE_AUTO = 2;      //自动取消
    const CANCEL_PAY_TYPE_ADMIN = 3;     //后台管理员

    const CANCEL_PAY_METHOD_PORT = [
        self::CANCEL_PAY_TYPE_USER  => '用户取消',     //用户取消
        self::CANCEL_PAY_TYPE_AUTO  => '自动取消',     //自动取消
        self::CANCEL_PAY_TYPE_ADMIN => '后台取消',     //后台管理员
    ];

    //订单详情状态
    const  ORDER_DETAIL_STATUS_WAIT = 0;  //0 待发货
    const  ORDER_DETAIL_STATUS_SEND = 1;  //1已发货
    const  ORDER_DETAIL_STATUS_SURE = 2;  //2已收货

    public static $orderProductStatus = [
         self::ORDER_DETAIL_STATUS_WAIT => '待发货',
         self::ORDER_DETAIL_STATUS_SEND => '已发货',
         self::ORDER_DETAIL_STATUS_SURE => '已收货',
    ];

    //订单状态
    const ORDER_STATUS_WAIT_PAY = 0;    //未支付
    const ORDER_STATUS_PAYED = 1;       //待发货  已支付
    const ORDER_STATUS_SEND = 2;        //已经发货
    const ORDER_STATUS_ESTIMATE = 3;    //待评价 （确认收货）
    //const ORDER_STATUS_SALE = 4;        //售后中
    const ORDER_STATUS_CANCEL = 5;      //取消支付
    const ORDER_STATUS_FINISH = 6;      //已完成
    const ORDER_STATUS_WAIT_GROUP = 7;  //待成团（拼团订单）
    const ORDER_STATUS_WAIL_SELF = 8;   //待自提

    public static $orderStatusName = [
        self::ORDER_STATUS_WAIT_PAY => '待付款',
        self::ORDER_STATUS_PAYED => '待发货',
        self::ORDER_STATUS_SEND => '已发货',
        self::ORDER_STATUS_ESTIMATE => '待评价',
        self::ORDER_STATUS_CANCEL => '已取消',
        self::ORDER_STATUS_FINISH => '已完成',
        self::ORDER_STATUS_WAIT_GROUP => '待成团',
        self::ORDER_STATUS_WAIL_SELF => '等待收货'
    ];
    //自提订单状态
    public static $orderMentionStatusName = [
        self::ORDER_STATUS_WAIT_PAY => '待付款',
        self::ORDER_STATUS_PAYED => '等待提货',
        self::ORDER_STATUS_SEND => '已自提',   //自提不存在此状态
        self::ORDER_STATUS_ESTIMATE => '待评价',
        self::ORDER_STATUS_CANCEL => '已取消',
        self::ORDER_STATUS_FINISH => '已完成',
        self::ORDER_STATUS_WAIT_GROUP => '待成团',
    ];

    //售后状态
    const ORDER_AFTER_STATUS_NO = 0;        //无售后
    const ORDER_AFTER_STATUS_MIDDLE = 1;    //售后中
    const ORDER_AFTER_STATUS_FINISH = 2;    //售后完成
    const ORDER_AFTER_STATUS_NULL = 3;    //不可售后

    //推送状态
    const ORDER_PUSH_STATUS_WAIT = 0;       //待推送
    const ORDER_PUSH_STATUS_SEND = 1;       //已推送
    const ORDER_PUSH_STATUS_DELIVERY = 2;   //已发货
    const ORDER_PUSH_STATUS_CANCEL = 3;     //已取消

    //订单日志类型
    const ORDER_LOG_TYPE_USER = 1;   //用户操作
    const ORDER_LOG_TYPE_PLATFORM = 2;   //平台操作
    const ORDER_LOG_TYPE_SYSTEM = 3;    //系统操作

    //运费类型
    const FREIGHT_TYPE_FREE = 1;     //1包邮
    const FREIGHT_TYPE_GLOBAL = 2;     //2全局
    const FREIGHT_TYPE_CUSTOM = 3;     //3自定义

    //退款
    const ORDER_REFUND_PENDING = 0;      //待处理
    const ORDER_REFUND_AGREE = 1;      //同意退款
    const ORDER_REFUND_HANDLED = 2;      //已处理
    const ORDER_REFUND_UNDERWAY = 3;      //退款中
    const ORDER_REFUND_SUCCESS = 4;      //退款成功
    const ORDER_REFUND_FAIL = 5;      //退款失败
    const ORDER_REFUND_CLOSE = 6;      //退款关闭
    //第三方退款状态
    const ORDER_REFUND_STATUS_SUCCESS = 1;      //退款成功
    const ORDER_REFUND_STATUS_CHANG = 2;      //退款异常
    const ORDER_REFUND_STATUS_CLOSE = 3;      //退款关闭
    const ORDER_REFUND_STATUS_FAIL = 4;      //退款请求失败

    //是否结算
    const IS_INCOME_NULL = 0;     //未结算
    const FREIGHT_TYPE_YES = 1;     //可提现
    const FREIGHT_TYPE_END = 2;     //完成


    //订单优惠类型
    const ORDER_DISCOUNT_TYPE_COUPON = 1;
    const ORDER_DISCOUNT_TYPE_MEMBER_LEVEL = 2;
    const ORDER_DISCOUNT_TYPE_SEND_BY_POST = 3;    //包邮活动

    //优惠针对
    const DISCOUNT_TYPE_GOODS = 1;      //针对商品
    const DISCOUNT_TYPE_DISTRIBUTION = 2;    //针对运费
    const DISCOUNT_TYPE_ORDER = 3;    //针对整个订单

    //发货类型
    const SEND_TYPE_PLATFORM = 1;    //平台发货
    const SEND_TYPE_AGENT = 2;         //代理发货
    const SEND_TYPE_All = 3;         //平台发货/代理发货

    //取货类型
    const ORDER_TAKE_TYPE_TRACK = 0;    //物流
    const ORDER_TAKE_TYPE_SELF = 1;     //自提
    const ORDER_TAKE_TYPE_SHOP = 2;     //到店消费订单
    const ORDER_TAKE_TYPE_DISPATCHING = 3;     //同城配送订单

    public static $orderTackName = [
        self::ORDER_TAKE_TYPE_TRACK => '物流快递',
        self::ORDER_TAKE_TYPE_SELF => '到店自提',
    ];
    public static $orderTypeName = [
        self::ORDER_TAKE_TYPE_TRACK => '物流订单',
        self::ORDER_TAKE_TYPE_SELF => '自提订单',
    ];

    public static $orderTakeType =[
        self::ORDER_TAKE_TYPE_TRACK => '物流订单',
        self::ORDER_TAKE_TYPE_SELF => '到店自提',
        self::ORDER_TAKE_TYPE_SHOP => '到店消费',
        self::ORDER_TAKE_TYPE_DISPATCHING => '同城配送',
    ];

    const  NOT_SHIPPED = 0;   //未发货
    const  PARTIAL_DELIVERY  = 1; //部分发货
    const  SHIP_ALL   = 2; //全部发货

    const   PRODUCT_STATUS_WAIT = 0; //待发货
    const   PRODUCT_STATUS_SEND = 1; //已发货
    const   PRODUCT_STATUS_GET = 2; //已收货
    const   PRODUCT_STATUS_REFUND = 3; //发起退货
    const   PRODUCT_STATUS_SURE_REFUNG = 4; //确认退货

    public static $productStatusName = [
        self::PRODUCT_STATUS_WAIT => '待发货',
        self::PRODUCT_STATUS_SEND => '已发货',
        self::PRODUCT_STATUS_GET => '已收货',
        self::PRODUCT_STATUS_REFUND => '发起退货',
        self::PRODUCT_STATUS_SURE_REFUNG => '确认退货',
    ];

    /**
     * 订单活动类型
     */
    const ACTIVITY_TYPE_NONE = 0;    //无活动
    const ACTIVITY_TYPE_GROUP = 1;    // 拼团
    const ACTIVITY_TYPE_POINT = 2;    // 积分商城
    const ACTIVITY_TYPE_SECKILL = 3;    // 秒杀


    /**
     * 订单活动类型描述
     */
    public static $activityTypeDes = [
        self::ACTIVITY_TYPE_NONE => '普通',
        self::ACTIVITY_TYPE_SECKILL => '秒杀',
        self::ACTIVITY_TYPE_GROUP => '拼团',
        self::ACTIVITY_TYPE_POINT => '积分',
    ];


    //电子面单发货类型
    const ORDER_SINGLE_TYPE_NORMAL = 0; //正常单个发货
    const ORDER_SINGLE_TYPE_MERGE = 1; //合并发货

    //订单是否评价过
    const ORDER_IS_COMMENT_YES = 1;  //已评论
    const ORDER_IS_COMMENT_NO = 0;   //未评论


    //订单详情入口类型
    const BUSINESS_DETAIL = 0; //订单列表进入的详情
    const BUSINESS_SEND = 1; //发货进入的详情

    const  PAY_TYPE_WECHAT = 0;  //0 微信支付
    const  PAY_TYPE_ADMIN = 1;  // 1 管理员支付
    const  PAY_TYPE_PC_WECHAT = 2;  // 1 电脑端微信支付
    const  PAY_TYPE_PC_ALIPAY = 3;  // 1 电脑端支付宝支付

    public static $payTypeDes = [
        self::PAY_TYPE_WECHAT=>'微信支付',
        self::PAY_TYPE_ADMIN=>'管理员支付',
        self::PAY_TYPE_PC_WECHAT=>'电脑端微信支付',
        self::PAY_TYPE_PC_ALIPAY=>'电脑端支付宝支付',
    ];

    const COMMON_ORDER = 0;// 普通订单
    const POINT_ORDER = 1;//积分订单
}
